#include <iostream>
using namespace std;

//数组指针 指向数组的指针
void test0()
{
    int arr[5] = {1,2,3,4,5};
    cout << arr << endl;
    cout << arr + 1 << endl;

    cout << &arr << endl;
    cout << &arr + 1 << endl;

    int (*p)[5] = &arr;

    for(int i = 0;i < 5; ++i){
        cout << (*p)[i] << " ";
    }
    cout << endl;
}

//指针数组，数组中的元素是指针
void test1(){
    int num = 1,num2 = 2,num3 = 3;
    int * p1 = &num;
    int * p2 = &num2;
    int * p3 = &num3;
    int* arr[3] = {p1,p2,p3};

    for(int i = 0;i < 3;++i){
        cout << *arr[i] << " ";
    }
    cout << endl;
}

int main(int argc, char * argv[])
{
    test0();
    test1();
    return 0;
}

